﻿#include "net_mgr.h"

UDPSlave* NetMgr::upd_client = NULL;
UDPMaster* NetMgr::upd_server = NULL;
TCPClient* NetMgr::tcp_client = NULL;

NetMgr::NetMgr() {}

void  NetMgr::init_net()
{
	//235.0.0.20
	//组播端口：10020
	//192.168.1.xxxxx

    upd_server = new UDPMaster;
    upd_server->InitSocket("235.0.0.20", 10020);

    upd_client = new UDPSlave;
    upd_client->InitSocket("235.0.0.20", 10020);

	tcp_client = new TCPClient;
    QString serverIP = "192.168.1.199";
    tcp_client->InitSocket(serverIP, 10010);
	tcp_client->InitTimer();
}

void NetMgr::send_tcp_data(QByteArray _data)
{
	tcp_client->SendData(_data);
}
